<%@ page language="java" pageEncoding="utf-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>

<link rel="stylesheet" href="${aier_css_url}social/module/icon.css" />
<link rel="stylesheet" href="${aier_css_url}social/module/homehead.css" />
<script type="text/javascript">
var site_url = "${aier_url}";


$(document).ready(function() {
    var h2 = $(window).outerHeight() -42;
    $('.window-content').css({'min-height':h2,'_height':'expression(this.scrollHeight <'+h2+'? "'+h2+'" : "auto")'})
});

</script>
<style>
.header-push {
	position: absolute;
	top: 40px;
	right: 38px;
	width: 140px;
	border: 1px solid #666;
	border-top: 0px;
	background-color: #fff;
	z-index: 1;
	padding: 0 5px;
	display: none;
	font-size:12px;
}

.header-push-open {
	display: block;
}

.header-push .push {
	height:32px;
	line-height: 32px;
	font-size:12px;
}

.header-push .push strong {
	color: #ff6666;
}

</style>

<div class="window-header">
	<div class="header-bar clearfix">
		<div class="header-logo">
			<a class="header-logo-img"
				href="${aier_url}user/userhomeforums_homeForums.shtml"></a>
		</div>
		<div class="header-nav">
			<ul class="float-list clearfix">
				<li><a class="nav-btn"
					href="${aier_url}user/userhomeforums_homeForums.shtml?uid=${uid}">首页</a>
				</li>
				<li><a class="nav-btn" href="${aier_url}user/uccomm_userCenter.shtml?in_uid=${uid}">个人主页</a>
				</li>
			</ul>
		</div>
		<!-- 
		<div class="header-search clearfix">
			<input type="text" placeholder="找内容"> <a
				class="search-btn icon-1 icon-1-hfc" href=""></a>
		</div>
        -->
		<div class="header-user clearfix">
			<div class="header-user-aset">
				<i id="hmsgIcon" class="user-btn icon-1 icon-1-hmsg-white"></i>


				<!-- 下拉层 -->
				<div id="hMSetting" class="gn_topmenulist gn_topmenulist_set"
					style="display: none;">
					<ul class="gn_text_list">
						<li><a target="_top"
							href="${aier_url}user/usermessage_userMessageComment${aier_suffix}?uid=${uid}">查看评论</a>
						</li>


						<li><a target="_top"
							href="${aier_url}user/usermessage_userMessageLetter${aier_suffix}?uid=${uid}">查看私信</a>
						</li>

						<li><a target="_top"
							href="${aier_url}user/usermessage_userMessageNotice${aier_suffix}?uid=${uid}"><span></span>通知</a>
						</li>
					</ul>

				</div>
			</div>
			<div class="header-user-aset">

				<i id="asetIcon" class="user-btn icon-1 icon-1-hset-white"></i>
				<!-- 下拉层 -->
				<div id="hASetting" class="gn_topmenulist gn_topmenulist_set"
					style="display: none;">
					<ul class="gn_text_list">
						<li><a target="_top"
							href="${aier_url}user/useraccountsettings_personalInfo${aier_suffix}?uid=${uid}">帐号设置</a>
						</li>

					</ul>
					<!--  <ul class="gn_text_list">
						<li><a target="_top"
							href="http://badge.weibo.com/1680218125?topnav=1&amp;wvr=5">我的班级</a>
						</li>
						<li><a target="_top"
							href="http://badge.weibo.com/1680218125?topnav=1&amp;wvr=5">我的家人</a>
						</li>
					</ul>-->

					<div class="gn_func">
						<a target="_top" href="${aier_url}user/logout${aier_suffix}">退出</a>
					</div>
				</div>
			</div>
			

			
			
		</div>
		
		<!-- header-push -->
		<div class="header-push" id="headerPush">
		</div>
		<!-- /header-push -->
		
		
	</div>
	<!-- /headerbar -->
	


	
</div>

<!--[if lte IE 6]>
		<style>
.icon-2 {background-image:url(${aier_css_url}social/user/common/img/icon_03.gif)}
		</style>
	<![endif]-->

<script type="text/javascript">
	$("#hASetting").parent().hover(function() {
		$("#hASetting").css("display", "inline");
		
		$("#asetIcon").addClass("user-btn icon-1 icon-1-hset-black");
	}, function() {
		$("#hASetting").css("display", "none");
		$("#asetIcon").removeClass("user-btn icon-1 icon-1-hset-black");
		$("#asetIcon").addClass("user-btn icon-1 icon-1-hset-white");
	});
	
	$("#hMSetting").parent().hover(function() {
		$("#hMSetting").css("display", "inline");
		
		$("#hmsgIcon").addClass("user-btn icon-1 icon-1-hmsg-black");
	}, function() {
		$("#hMSetting").css("display", "none");
		$("#hmsgIcon").removeClass("user-btn icon-1 icon-1-hmsg-black");
		$("#hmsgIcon").addClass("user-btn icon-1 icon-1-hmsg-white");
	});
</script>

<!-- push 消息推送 -->

<script type="text/javascript">

    // push 消息推送
    var tplFans = '<div class="push push-fans"><strong></strong>个新粉丝，<a onclick = "lookMessage(1)">查看粉丝</a></div>';
    var tplAt = '<div class="push push-at"><strong></strong>条新@提醒，<a onclick = "lookMessage(2)">查看@提醒</a></div>';
    var tplNotice = '<div class="push push-notice"><strong></strong>条新通知，<a onclick = "lookMessage(3)">查看通知</a></div>';
    var tplLetter = '<div class="push push-letter"><strong></strong>条新私信，<a onclick = "lookMessage(4)">查看私信</a></div>';
    
    var $headerPush = $('#headerPush');
    
    $(document).ready(function() {
        setTimeout("handler()",5000);
        setInterval( "handler()" , 60000);
    }); 
    function handler(){
        var fun=function(data){
            if(data.s==1){
                $headerPush.html("");
                if ($headerPush.hasClass('header-push-open')) {
                     $headerPush.removeClass('header-push-open');
                }
               
                if (data.strList[0] != 0) {
                    $headerPush.append(tplFans);
                    $headerPush.find('.push-fans').children('strong').text(data.strList[0]);
                }
                if (data.strList[1] != 0) {
                    $headerPush.append(tplAt);
                    $headerPush.find('.push-at').children('strong').text(data.strList[1]);
                }
                if (data.strList[2] != 0) {
                    $headerPush.append(tplNotice);
                    $headerPush.find('.push-notice').children('strong').text(data.strList[2]);
                }
                if (data.strList[3] != 0) {
                    $headerPush.append(tplLetter);
                    $headerPush.find('.push-letter').children('strong').text(data.strList[3]);
                }
                if ($headerPush.html() != "") {
                    $headerPush.addClass('header-push-open');
                }
            } 
        };
        exeAjax(
             ajaxUrl("${aier_url}${aier_urijs}userhomecomm_searchLatestNotice${aier_suffix}"),
             fun,{
        });
    };
    
    function lookMessage(type) {
         // 更新查看动作的最新时间
         var fun=function(data){
	     };
	     exeAjax(
	          ajaxUrl("${aier_url}${aier_urijs}userhomecomm_insertAction${aier_suffix}"),
	          fun,{
	          "type":type
	     });
        
        // 跳转页面
        if (type == 1) {
            $headerPush.find('.push-fans').remove();
            if ($headerPush.html() == "") {
                $headerPush.removeClass('header-push-open');
            }
            window.location.href = "${aier_url}${aier_uri}usermyfans${aier_suffix}";
        }
        if (type == 2) {
            $headerPush.find('.push-at').remove();
            if ($headerPush.html() == "") {
                $headerPush.removeClass('header-push-open');
            }
            window.location.href = "${aier_url}${aier_uri}usermessage_userMessageSpecial${aier_suffix}";
        }
        if (type == 3) {
            $headerPush.find('.push-notice').remove();
            if ($headerPush.html() == "") {
                $headerPush.removeClass('header-push-open');
            }
            window.location.href = "${aier_url}${aier_uri}usermessage_userMessageNotice${aier_suffix}";
        }
        if (type == 4) {
            $headerPush.find('.push-letter').remove();
            if ($headerPush.html() == "") {
                $headerPush.removeClass('header-push-open');
            }
            window.location.href = "${aier_url}${aier_uri}usermessage_userMessageLetter${aier_suffix}";
        }
        
    }

 
</script>
